'use strict';

const conn = require('../../libs/DB/Conn');
module.exports = async function (params) {

    let querySql = `SELECT
                        uf.user_id AS userId,
                        uf.login_name AS loginName,
                        uf.user_name AS userName,
                        uf.mobile,
                        ug.group_name,
                        af.agent_name
                    FROM
                        user_file uf
                    INNER JOIN agent_file af ON af.agent_id = uf.agent_id
                    INNER JOIN user_group ug ON uf.group_id = ug.group_id  AND ug.group_id = 3 
                    WHERE
                        uf.agent_id = ?
                    AND uf.delete_sign = 1
                    ORDER BY uf.group_id ASC`;
    let result = await conn(querySql,[params.agentId]);

    return {success:true,data:result}
};